import GameDataMgr from "./GameDataMgr";
import EventMgr from "./EventMgr";
import HotUpdate from "./HotUpdate";
import SystemDataSys from "./SystemDataSys";
import frameworkManager from "./frameworkManager";

const { ccclass, property } = cc._decorator;

@ccclass
export default class WebNodeCtrl extends cc.Component {
    @property(cc.WebView)
    web = null;

    onLoad() {
        EventMgr.listen(GameEventType.SHOW_XIAOMI_PRI, this.clickAgreement, this);
    }

    start() {}

    onDestroy() {
        EventMgr.ignore(GameEventType.SHOW_XIAOMI_PRI, this.clickAgreement, this);
    }

    init() {}

    clickAgreement(e) {
        // this.node.active = true;
        // const isOnlineRelease = !HotUpdate.getInstance().isOnlineRelease();
        // let url = "";
        // if (e === GameDataMgr.WebUrlType.USER_TYPE) {
        //     url = SystemDataSys.user_url + "&debug=" + isOnlineRelease;
        // } else {
        //     url = SystemDataSys.privacy_url;
        // }
        // url += "&fd=1";
        // frameworkManager.log("webUrl===webUrl", url);
        // this.web.url = url;
    }

    close() {
        this.node.active = false;
    }
}
